package com.api.shopapi.service.impl;


import com.api.shopapi.entity.VolunteerTeam;
import com.api.shopapi.mapper.VolunteerTeamMapper;
import com.api.shopapi.service.VolunteerTeamService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("VolunteerTeamServiceImplOne")
public class VolunteerTeamServiceImpl implements VolunteerTeamService {

    @Autowired
    private VolunteerTeamMapper volunteerTeamMapper;

    @Override
    public
    int insert(VolunteerTeam volunteerTeam){
        return volunteerTeamMapper.insert(volunteerTeam);
    }

    @Override
    public
    int delete(String volunteerTeamCode){
        return volunteerTeamMapper.delete(volunteerTeamCode);
    }


    @Override
    public
    int update(VolunteerTeam volunteerTeam){
        return volunteerTeamMapper.update(volunteerTeam);
    }


    @Override
    public
    VolunteerTeam getByVolunteerTeamCode(String volunteerTeamCode){
        return volunteerTeamMapper.getByVolunteerTeamCode(volunteerTeamCode);
    }


    @Override
    public
    VolunteerTeam getByUserCode(String userCode){
        return volunteerTeamMapper.getByUserCode(userCode);
    }



    @Override
    public
    List<VolunteerTeam> listByCommandCenterCode(String commandCenterCode, int applyStatus){
        return volunteerTeamMapper.listByCommandCenterCode(commandCenterCode,applyStatus);
    }

    @Override
    public
    PageInfo<VolunteerTeam> pageByCommandCenterCode(int pageIndex, int pageSize, String commandCenterCode,int applyStatus){
        PageHelper.startPage(pageIndex,pageSize);
        List<VolunteerTeam> list = volunteerTeamMapper.listByCommandCenterCode(commandCenterCode,applyStatus);
        return new PageInfo<>(list);
    }


    @Override
    public
    PageInfo<VolunteerTeam> pageByCommandCenterCodeApply(int pageIndex, int pageSize, String commandCenterCode){
        PageHelper.startPage(pageIndex,pageSize);
        List<VolunteerTeam> list = volunteerTeamMapper.listByCommandCenterCodeApply(commandCenterCode);
        return new PageInfo<>(list);
    }


    @Override
    public
    PageInfo<VolunteerTeam> pageByGovCode(int pageIndex, int pageSize, String governmentCode){
        PageHelper.startPage(pageIndex,pageSize);
        List<VolunteerTeam> list = volunteerTeamMapper.listByGovCode(governmentCode);
        return new PageInfo<>(list);
    }


}
